package com.jiazhong.shixi.diancan_xitong.controller;

import com.jiazhong.shixi.diancan_xitong.bean.Order;
import com.jiazhong.shixi.diancan_xitong.service.OrderService;
import com.jiazhong.shixi.diancan_xitong.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
@CrossOrigin("*")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/history")
    public JsonResult findOrderHistory(@RequestParam String cusId) {
        List<Order> orders = orderService.findOrdersByCusId(cusId);
        JsonResult result = new JsonResult(true, 200, orders, "");
        return result;
    }
}